package com.xxx.mapper;

import com.xxx.pojo.Employee;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface EmployeeMapper {


    @Delete("delete from employee where id = #{id};")
    int delById(Long id);

    @Select("select * from employee")
    @ResultMap("employeeResultMap")
    List<Employee> selectAll();


    @Select("select * from employee where id = #{id};")
    @ResultMap("employeeResultMap")
    Employee selectById(Long id);

    @Select("select * from employee where username = #{username};")
    @ResultMap("employeeResultMap")
    Employee selectByUsername(String username);


    @Insert("insert into employee values (#{id}, #{name}, #{username}, #{password}, #{phone}, #{sex}, #{idNumber}, #{status}, #{createTime}, #{updateTime}, #{createUser}, #{updateUser})")
    int addEmployee(Employee employee);

    @Update("update employee set name = #{name},username = #{username},password = #{password},phone = #{phone},sex = #{sex},id_number = #{idNumber},status = #{status},update_time = #{updateTime},update_user = #{updateUser} where id = #{id};")
    int updateEmployee(Employee employee);

    Employee selectEmployee(Employee employee);
}
